package com.github.xuemingyu.springboot.acticitycloud;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import net.coobird.thumbnailator.Thumbnails;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class compressImages {
    public static void main(String[] args) {
String str = "[123]";

        System.out.println(str.substring(1,str.length()-1));
       /* List list = new ArrayList();
        File file = new File("E:/images/");
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            File file1 = files[i];
            String fileName = file1.getName();
            String prefix = fileName.substring(fileName.lastIndexOf(".") + 1)
                    .toLowerCase();
            if ("jpg".equals(prefix) || "png".equals(prefix)
                    || "bmp".equals(prefix) || "gif".equals(prefix) || "jpeg".equals(prefix)) {
                list.add(fileName);
            }
        }
        System.out.println(list);

        try {
            Thumbnails.of("E:/images/1552732402692樱花盛开01.png")
                    .scale(1f)
                    .outputQuality(0.8d)
                    .toFile("E:/img/1552732402692樱花盛开01.jpg");
        } catch (IOException e) {
            e.printStackTrace();
        }*/
       /* try {
            HttpResponse<String> response = Unirest.post("http://alumnihome1893.whu.edu.cn:88/api/public/findMemberForm")
                    .field("password", "8cbecb6644d0330274bf1368133b53da")
                    .field("startTime","2019-03-05 00:00:00")
                    .asString();
            response.getBody();
            JSONObject o = (JSONObject) JSONObject.parse(response.getBody());
            JSONObject data = (JSONObject) o.get("data");
            JSONArray list = (JSONArray) data.get("list");
            System.out.println(list.size());
            System.out.println(response.getBody());
        } catch (UnirestException e) {
            e.printStackTrace();
        }*/


    }
}

